const app = getApp()
const global = app.globalData
Component({
    properties: {
        info:{type:Object, value:{}}
    },
    data: {
        statusList:{
            unpaid:{image: `${global.imageUrl}/uniapp/icon_order_unpaid.png`, title: '待付款', id:'unpaid', num:0},
            wait:{image: `${global.imageUrl}/uniapp/icon_order_wait.png`, title: '待发货', id: 'wait', num:0},
            receive:{image: `${global.imageUrl}/uniapp/icon_order_receive.png`, title: '待收货', id: 'receive', num:0},
            reply:{image: `${global.imageUrl}/uniapp/icon_order_reply.png`, title: '待评价', id: 'reply', num:0},
            refund: {image: `${global.imageUrl}/uniapp/icon_order_refund.png`, title: '退款/售后', id: 'refund',num:0},
        },
    },
    observers:{
        "info":function (data){
            const {statusList} = this.data
            if (data){
                statusList.unpaid.num = data.unpaid
                statusList.wait.num = data.wait
                statusList.receive.num = data.receive
                statusList.reply.num = data.reply
                this.setData({
                    statusList,
                })
            }

        }
    },
    lifetimes:{
        attached() {

        }
    },
    methods: {
        statusClick(e){
            const {status} = e.currentTarget.dataset
            if (status != 'refund'){    // 非退款
                wx.navigateTo({
                    url:`/pages/user/order/index?order_status=${status}`
                })
            }else{
                wx.navigateTo({
                    url:`/pages/user/order/refund_list`
                })
            }
        },
    }
});
